package mode.decorator.decorator;

/**
 * 装饰器模式测试
 *
 * @author xjx
 * @date 2023/7/21 16:13
 */
public class MainTest {
    public static void main(String[] args) {
        FriedRice friedRice = new FriedRice();
        // 炒饭5元
        System.out.println(friedRice.getDesc() + friedRice.getPrice() + "元");
        friedRice = new Egg(friedRice);
        // 炒饭+鸡蛋7元
        System.out.println(friedRice.getDesc() + friedRice.getPrice() + "元");
        friedRice = new Egg(friedRice);
        // 炒饭+鸡蛋+鸡蛋9元
        System.out.println(friedRice.getDesc() + friedRice.getPrice() + "元");
        friedRice = new Ham(friedRice);
        // 炒饭+鸡蛋+鸡蛋+火腿12元
        System.out.println(friedRice.getDesc() + friedRice.getPrice() + "元");
    }
}
